;-------------------------------------------------------------------------------------

;this routine makes all the shifted sprite-images to speed-up clipping.
;8 sprites (each shifted one pixel to the right) are calculated
;each sprite-image is only 15 pixels high to save memory

genspriteimages
         ldx #44
         lda balldata,x
         sta spriteimages,x
         lda balldata2,x
         sta spriteimages2,x
         lda balldata3,x
         sta spriteimages3,x
	dex
         bpl *-19

         lda #<spriteimages
         sta low
         lda #>spriteimages
         sta high

         lda #<spriteimages+48
         sta low2
         lda #>spriteimages+48
         sta high2

         jsr genspritejsr           ;make $c color shifted sprite images

         lda #<spriteimages2
         sta low
         lda #>spriteimages2
         sta high

         lda #<spriteimages2+48
         sta low2
         lda #>spriteimages2+48
         sta high2

         jsr genspritejsr           ;make $f images

         lda #<spriteimages3
         sta low
         lda #>spriteimages3
         sta high

         lda #<spriteimages3+48
         sta low2
         lda #>spriteimages3+48
         sta high2

         jsr genspritejsr           ;make $b images

         ;clear sprite-image for on the screen

         ldx #$3e
         lda #0
         sta spriteimage,x
         sta spriteimage2,x
         sta spriteimage3,x
         sta spriteimageb,x
         sta spriteimage2b,x
         sta spriteimage3b,x
         sta spriteimagec,x
         sta spriteimage2c,x
         sta spriteimage3c,x
         dex
         bpl *-28

         rts

genspritejsr
         ldx #7         ;calc one new sprite from the previous one
         ldy #0
genimageloop
         lda (low),y
         lsr
         sta (low2),y
         iny
         lda (low),y
         ror
         sta (low2),y
         iny
         lda (low),y
         ror
         sta (low2),y
         iny
         cpy #45
         bne genimageloop

	lda high2
	sta high
         lda low2
         sta low
         clc
         adc #$30
         sta low2
         bcc *+4
         inc high2
         dex
         bne genimageloop-2

         rts

;-------------------------------------------------------------------------------------

*=balldata  ;sprite data for the ball $c+$f+$b color
         .byte $07,$c0,0
         .byte $1f,$f0,0
         .byte $3f,$f8,0
         .byte $7f,$fc,0
         .byte $7f,$fc,0
         .byte $ff,$fe,0
         .byte $ff,$fe,0
         .byte $ff,$fe,0
         .byte $ff,$fe,0
         .byte $ff,$fe,0
         .byte $7f,$fc,0
         .byte $7f,$fc,0
         .byte $3f,$f8,0
         .byte $1f,$f0,0
         .byte $07,$c0,0

balldata2  ;sprite data for the ball $f+$b color
         .byte $00,$00,0
         .byte $0a,$00,0
         .byte $15,$00,0
         .byte $3e,$84,0
         .byte $5f,$40,0
         .byte $3e,$84,0
         .byte $5d,$4a,0
         .byte $2a,$86,0
         .byte $15,$0a,0
         .byte $0a,$16,0
         .byte $00,$2c,0
         .byte $00,$5c,0
         .byte $0a,$b8,0
         .byte $15,$70,0
         .byte $07,$c0,0

balldata3  ;sprite data for ball color $b
         .byte $00,$00,0
         .byte $00,$00,0
         .byte $00,$00,0
         .byte $00,$04,0
         .byte $00,$00,0
         .byte $00,$04,0
         .byte $00,$0a,0
         .byte $00,$06,0
         .byte $00,$0a,0
         .byte $00,$16,0
         .byte $00,$2c,0
         .byte $00,$5c,0
         .byte $0a,$b8,0
         .byte $15,$70,0
         .byte $07,$c0,0

